home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / emac16as.arc / MINT.DEF < prev    next >
Text File  |  1990-04-01  |  2KB  |  104 lines

  1. timing    equ    0        ;conditional assembly flag for the
  2.                 ;  profiling code.
  3.  
  4. mark_overhead    equ    3    ;one mark byte + one pointer (3 bytes total)
  5.  
  6. define_buffer    macro    x
  7. x&prev_buffer    dw    ?
  8. x&next_buffer    dw    ?
  9. x&toptop    dw    ?
  10. x&topbot    dw    ?
  11. x&bottop    dw    ?
  12. x&botbot    dw    ?
  13. x&new_size    dw    ?
  14.     endm
  15.  
  16. ;see if di is still below actptr.  If it isn't, we've run out of memory and
  17. ;  must abort.
  18. chk_room    macro    segreg
  19.     local    ok
  20.     cmp    di,data_bottop
  21.     jb    ok
  22.     push    ax
  23.     push    cx
  24.   ifnb <segreg>
  25.     mov    ax,segreg
  26.   else
  27.     mov    ax,ds
  28.   endif
  29.     mov    data_topbot,di
  30.     mov    cx,100            ;if we can't get 100 free bytes,
  31.     call    buffer_free        ;  we may as well not try for only 1.
  32.     pop    cx
  33.     pop    ax
  34.     jnc    ok
  35.     call    nomem
  36. ok:
  37.     endm
  38.  
  39. ;see if di+cx is still below data_bottop.  If it isn't, we've run out of memory
  40. ;  and must abort.
  41. chk_room_cnt    macro    segreg
  42.     local    not_ok, ok
  43.     push    di
  44.     add    di,cx
  45.     jc    not_ok
  46.     cmp    di,data_bottop
  47.     pop    di
  48.     jb    ok
  49.     push    di
  50. not_ok:
  51.     pop    di
  52.     push    ax
  53.   ifnb <segreg>
  54.     mov    ax,segreg
  55.   else
  56.     mov    ax,ds
  57.   endif
  58.     mov    data_topbot,di
  59.     call    buffer_free
  60.     pop    ax
  61.     jnc    ok
  62.     call    nomem
  63. ok:
  64.     endm
  65.  
  66. ;make di point to fbgn and push a copy of it.
  67. ;this macro is used by functions that return a value and don't need their
  68. ;  arguments.  More efficient than di_points_fend.
  69. di_points_fbgn    macro
  70.     mov    di,fbgn
  71.     dec    di
  72.     push    di
  73.     endm
  74.  
  75. ;make di point to fend and push a copy of it.
  76. ;this macro is used by functions that need their arguments.
  77. di_points_fend    macro
  78.     mov    di,fend
  79.     add    di,2
  80.     push    di
  81.     endm
  82.  
  83.  
  84. xchgdses    macro
  85.     push    ds
  86.     push    es
  87.     pop    ds
  88.     pop    es
  89.     endm
  90.  
  91.  
  92. dsdata    macro
  93.     push    ss
  94.     pop    ds
  95.     assume    ds:data
  96.     endm
  97.  
  98.  
  99. esdata    macro
  100.     push    ss
  101.     pop    es
  102.     assume    es:data
  103.     endm
  104.